<ul class="nav nav-tabs" role="tablist">
  <li><a href="<?php echo $this -> url('home', array('action' => 'main')); ?>">Back to Main Menu</a></li>
  <li><a href="<?php echo $this -> url('insert', array('action' => 'insert')); ?>">New Item</a></li>
  <li class="active"><a href="<?php echo $this -> url('transaksi', array('action' => 'transaksi')); ?>">Transaksi</a></li>
  <li><a href="<?php echo $this -> url('report', array('action' => 'report')); ?>">Report</a></li>
  <li ><a href="<?php echo $this -> url('login/logout', array('action' => 'logout')); ?>">Logout</a></li>
</ul>
<h3>
	Beli Barang Baru
</h3>


<?php
$form = $this -> form;
$form->setAttribute('action', $this->url(
    'transaksi',
    array(
        'action' => 'add',
    )
));
$form -> prepare();
echo $this->form()->openTag($form);
?>
<div id='formContainer'>
	<div id='formNama'>
		<?php
		echo $this -> formLabel($form -> get('namaBarang'));?><BR><?php
		echo $this -> formElement($form -> get('namaBarang'));?>
	</div>
	<br>
	<div id='formJumlah'>
		<?php
		echo $this -> formLabel($form -> get('stok'));?><BR><?php
		echo $this -> formElement($form -> get('stok'));?>
		<h5 style="color:red">
			<?php
				echo $this -> formElementErrors($form -> get('stok'));
			?>
		</h5>
	</div>
	
	<br>
	<div id='formInsertSubmit'>
		<?php
		echo $this -> formElement($form -> get('btnSubmit'));
		?>
	</div>

</div>
<?php
echo $this->form()->closeTag($form);
?>
<br>
<br>
<Table class='table table-striped'>
	<tr>
		<th>
			Nama Barang
		</th>
		<th>
			Harga Barang
		</th>
		<th>
			Jumlah Beli
		</th>
		<th>
			Total
		</th>
		<th>
			
		</th>	
	</tr>
	
<?php foreach($arrayData as $detail) : ?>
	<tr>
		<td>
			<?php echo $detail['namaBarang']; ?> 
		</td>
		<td>
			<?php echo $detail['hargaBarang']; ?> 
		</td>
		<td>
			<?php echo $detail['stokBarang']; ?> 
		</td>
		<td>
			<?php echo $detail['subtotal'];?> 
		</td>
		<td style="width: 75px;">
			<form method="post" action="">
			<input type="hidden" name="idDelete" value="<?php echo $detail['idBarang']; ?>"/>
			<input class='btn btn-default' type="submit" name="deleteBtn" onclick="if (confirm('Apakah anda yakin ingin cancel Barang ini?')) { return true; } return false;" value="Cancel"/>
			</form>
		</td>
	</tr>
<?php endforeach; ?>
<tr>
	<td>
		&nbsp;&nbsp;
	</td>
	<td>
		&nbsp;&nbsp;
	</td>
	<td>
		Total :
	</td>
	<td>
		<?php echo $totalAll;?>
	</td>
	<td>
		&nbsp;&nbsp;
	</td>
</tr>
</Table>

<BR>
	
<a href="<?php echo $this -> url('transaksi', array('action' => 'beli')); ?>" onclick="if (confirm('Apakah anda yakin ingin akhiri transaksi?')) { return true; } return false;" >Akhiri Transaksi</a>

<h4 style='color:red;'>
<?php
	foreach ($messages as $message) {
		echo $message;
		echo "<BR>";
		echo "<BR>";
	}

?>
</h4>